﻿using Microsoft.Win32;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Input;

namespace TgaScanner
{
    internal class MainWindowViewModel : ObservableObject
    {
        public MainWindowViewModel()
        {
            SelectedDirectory = "E:\\SGameProj\\Project\\Assets\\Art_Resources\\Shared\\Characters\\Hero";

            SelectCommand = new SelectDirectoryCommand(this);
            ScanCommand = new ScanDirectoryCommand(this);
            ExportCommand = new ExportFileItemsCommand(this);

            FileItems = new ObservableCollection<FileItem>();

            StatusText = "请选择你要扫描的目录。";
        }

        private string selectedDirectory;

        public string SelectedDirectory
        {
            get
            {
                return selectedDirectory;
            }
            set
            {
                selectedDirectory = value;
                RaisePropertyChanged();
            }
        }

        public ICommand selectCommand;

        public ICommand SelectCommand
        {
            get { return selectCommand; }
            set
            {
                selectCommand = value;
                RaisePropertyChanged();
            }
        }

        private ICommand scanCommand;
        public ICommand ScanCommand
        {
            get { return scanCommand; }
            set
            {
                scanCommand = value;
                RaisePropertyChanged();
            }
        }

        public ICommand exportCommand;

        public ICommand ExportCommand
        {
            get { return exportCommand; }
            set
            {
                exportCommand = value;
                RaisePropertyChanged();
            }
        }




        private ObservableCollection<FileItem> fileItems;

        public ObservableCollection<FileItem> FileItems
        {
            get { return fileItems; }
            set
            {
                fileItems = value;
                RaisePropertyChanged();
            }
        }





        private string statusText;

        public string StatusText
        {
            get { return statusText; }
            set
            {
                statusText = value;
                RaisePropertyChanged();
            }
        }
    }
}
